#include <iostream>
using namespace std;



// forward declare
class A;
class B;

// class declare
class B
{
public:
    void saysomething(A& a);
private:
    void saybye(A& a);
    friend class A;
};

class A
{
    friend void B::saybye(A&);
private:
    void sayhi();
};


// method declare
void A::sayhi()
{
    cout << "hi" << endl;
}

void B::saysomething(A& a)
{
    saybye(a);
}

void B::saybye(A& a)
{
    a.sayhi();
    cout << "bye" << endl;
}




class Amount;

class Amount2{
private:
    double increase;
    friend class Amount;
public :
    Amount2(double i)
    {
        increase = i;
    }
   void rect(Amount &a);

};

class Amount{
private:
    double rate;
public :

    Amount(double r)
    {
        rate = r;
    }

    friend void Amount2::rect(Amount &a);

    void sr()
    {
        std::cout << "rate" << rate << std::endl;
    }
};


int main() {

    A a;
    B b;
    b.saysomething(a);
    return 0;



    Amount2 a2(34.52);
    Amount a1(12.22);
    a2.rect(a1);
    a1.sr();
    a2.rect(a1);
    a1.sr();
    a2.rect(a1);
    a1.sr();
//    std::cout << "count(a1):" << count(a1) <<"   count(a2):" << count(a2) << std::endl;




    return 0;
}
